#include "arch/ia32/IA32ProcessorState.h"

using namespace crossbit;

void IA32ProcessorState::dumpToFile( XTFile fd )
{
	SYSCALL::XTWrite( fd, (void*)r_, sizeof(Word)*EOR );
	SYSCALL::XTWrite( fd, (void*)fpr_, sizeof(Word)*36 );
	SYSCALL::XTWrite( fd, (void*)fpu_stack, sizeof(XTUint8)*128 );
	SYSCALL::XTWrite( fd, (void*)&fpu_top, sizeof(XTMemAddr) );
	SYSCALL::XTWrite( fd, (void*)&p_tls, sizeof(int) );
}

void IA32ProcessorState::loadFromFile( XTFile fd )
{
	SYSCALL::XTRead( fd, (void*)r_, sizeof(Word)*EOR );
	SYSCALL::XTRead( fd, (void*)fpr_, sizeof(Word)*36 );
	SYSCALL::XTRead( fd, (void*)fpu_stack, sizeof(XTUint8)*128 );
	SYSCALL::XTRead( fd, (void*)&fpu_top, sizeof(XTMemAddr) );
	SYSCALL::XTRead( fd, (void*)&p_tls, sizeof(int) );
}

